﻿

include(FetchContent)

FetchContent_Declare(
    crc
    DOWNLOAD_EXTRACT_TIMESTAMP YES
    URL ${PROJECT_SOURCE_DIR}/third_package/CRCpp-release-1.2.0.0.tar.gz
    URL_HASH MD5=36e5df61d1eb0292736d54c060fcff05
)

FetchContent_GetProperties(crc)

if(NOT crc_POPULATED)
    FetchContent_Populate(crc)
    add_subdirectory(${crc_SOURCE_DIR} ${crc_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

add_executable(ota ota.cpp)
target_sources(ota PRIVATE chk.cpp)

target_link_libraries(ota PRIVATE CRCpp)
target_link_libraries(ota PRIVATE ar8030_client)
target_include_directories(ota PRIVATE ${PROJECT_SOURCE_DIR}/com)
target_link_libraries(ota PRIVATE com)

INSTALL(TARGETS ota
    RUNTIME DESTINATION dev_helper
)

# install(FILES conf.json DESTINATION dev_helper)

# INSTALL(DIRECTORY img DESTINATION dev_helper)
